﻿using System;
using System.Linq;
using System.Web.UI.WebControls;
using MONTRASEC_test.Classes;

namespace MONTRASEC_test.Controls
{
  public partial class wucDVB2Victims : System.Web.UI.UserControl
  {
    public Label LbTotalRecords
    {
      get { return lbTotalRecords; }
      set { lbTotalRecords = value; }
    }

    public Label LDVMode
    {
      get { return lbDVMode; }
      set { lbDVMode = value; }
    }
    public BulletedList BPleaseFillOtherTemplates
    {
      get { return bPleaseFillOtherTemplates; }
      set { bPleaseFillOtherTemplates = value; }
    }
    public DetailsView dv
    {
      get { return dvB2Victim; }
      set { dvB2Victim = value; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void dvB2Victim_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
      e.NewValues["B_2_VICTIM_PERSONALDATA_DATEOFBIRTH"] = UtilHelper.getDateTime(e.NewValues["B_2_VICTIM_PERSONALDATA_DATEOFBIRTH"]);

      e.NewValues["B_2_VICTIM_DIGEST"] = UtilHelper.getHash(e.NewValues["B_2_VICTIM_PERSONALDATA_IDENTITY_NAME"], e.NewValues["B_2_VICTIM_PERSONALDATA_NATIONALITY"], e.NewValues["B_2_VICTIM_PERSONALDATA_DATEOFBIRTH"]);

      e.NewValues["B_2_VICTIM_DIGEST_NFP"] = UtilHelper.getHash(UtilHelper.getHash(e.NewValues["B_2_VICTIM_DIGEST"]));

      //e.NewValues["B_2_VICTIM_A_NEWENTRY_ID"] = Session["CurrentANewEntryID"];

    }

    protected void dvB2Victim_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {

      e.Values["B_2_VICTIM_PERSONALDATA_DATEOFBIRTH"] = UtilHelper.getDateTime(e.Values["B_2_VICTIM_PERSONALDATA_DATEOFBIRTH"]);

      e.Values["B_2_VICTIM_DIGEST"] = UtilHelper.getHash(e.Values["B_2_VICTIM_PERSONALDATA_IDENTITY_NAME"], e.Values["B_2_VICTIM_PERSONALDATA_NATIONALITY"], e.Values["B_2_VICTIM_PERSONALDATA_DATEOFBIRTH"]);

      e.Values["B_2_VICTIM_DIGEST_NFP"] = UtilHelper.getHash(UtilHelper.getHash(e.Values["B_2_VICTIM_DIGEST"]));

      //e.Values["B_2_VICTIM_A_NEWENTRY_ID"] = Session["CurrentANewEntryID"];
    }

    protected void detailsView_ModeChanged(object sender, EventArgs e)
    {
      onDetailsView_ModeChanged(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ModeChangedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ModeChangedHandler DetailsView_ModeChanged;

    protected virtual void onDetailsView_ModeChanged(EventArgs e)
    {
      if (DetailsView_ModeChanged != null)
      {
        DetailsView_ModeChanged(this, e);
      }
    }

    protected void detailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
      onDetailsView_ItemDeleted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemDeletedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemDeletedHandler DetailsView_ItemDeleted;

    protected virtual void onDetailsView_ItemDeleted(EventArgs e)
    {
      if (DetailsView_ItemDeleted != null)
      {
        DetailsView_ItemDeleted(this, e);
      }
    }

    protected void detailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
      onDetailsView_ItemInserted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemInsertedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemInsertedHandler DetailsView_ItemInserted;

    protected virtual void onDetailsView_ItemInserted(EventArgs e)
    {
      if (DetailsView_ItemInserted != null)
      {
        DetailsView_ItemInserted(this, e);
      }
    }

    protected void detailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {

      onDetailsView_ItemUpdated(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemUpdatedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemUpdatedHandler DetailsView_ItemUpdated;

    protected virtual void onDetailsView_ItemUpdated(EventArgs e)
    {
      if (DetailsView_ItemUpdated != null)
      {
        DetailsView_ItemUpdated(this, e);
      }
    }

    protected void replicateARow(object sender, DetailsViewCommandEventArgs e)
    {
      String myMessage = ""; //message listing the id's that have been updated
      DetailsView dv = (DetailsView)sender;
      int index = int.Parse(e.CommandArgument.ToString());

      String id = (dv.DataKey["ID"]).ToString();

      MONTRASEC_test.Classes.A_NEWENTRY_DataContext dataContext = new MONTRASEC_test.Classes.A_NEWENTRY_DataContext();

      var newEntryToCopy =
          from b in dataContext.GetTable<A_NEWENTRY_>()
          where b.ID == long.Parse(id)
          select b;



      foreach (A_NEWENTRY_ c in newEntryToCopy)
      {
        var recordsToWhichToReplicate =
          from listOfRecordsToReplicate in dataContext.GetTable<A_NEWENTRY_>()
          where listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_POLICE_CUSTOMSFILEIDENTIF.Equals(c.A_NEWENTRY_NEWENTRY_POLICE_CUSTOMSFILEIDENTIF)
          && listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_PUBLICPROSECUTORSFILEIDEN.Equals(c.A_NEWENTRY_NEWENTRY_PUBLICPROSECUTORSFILEIDEN)
          && listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_COURTSFILEIDENTIFICATIONN.Equals(c.A_NEWENTRY_NEWENTRY_COURTSFILEIDENTIFICATIONN)
          && listOfRecordsToReplicate.ID != c.ID
          select listOfRecordsToReplicate;

        foreach (A_NEWENTRY_ recordToWhichToReplicate in recordsToWhichToReplicate)
        {
          recordToWhichToReplicate.B_2_Victim_DIGEST = c.B_2_Victim_DIGEST;
          recordToWhichToReplicate.B_2_Victim_DIGEST_NFP = c.B_2_Victim_DIGEST_NFP;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_IDENTITY_NAME = c.B_2_VICTIM_PERSONALDATA_IDENTITY_NAME;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_ALIAS = c.B_2_VICTIM_PERSONALDATA_ALIAS;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_NICKNAME = c.B_2_VICTIM_PERSONALDATA_NICKNAME;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_SEXOFTHEVICTIM = c.B_2_VICTIM_PERSONALDATA_SEXOFTHEVICTIM;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_DATEOFBIRTH = c.B_2_VICTIM_PERSONALDATA_DATEOFBIRTH;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_COUNTRYOFBIRTH = c.B_2_VICTIM_PERSONALDATA_COUNTRYOFBIRTH;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_PLACEOFBIRTH = c.B_2_VICTIM_PERSONALDATA_PLACEOFBIRTH;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_NATIONALITY = c.B_2_VICTIM_PERSONALDATA_NATIONALITY;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_FINGERPRINTS = c.B_2_VICTIM_PERSONALDATA_FINGERPRINTS;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_CRIMINALRECORD = c.B_2_VICTIM_PERSONALDATA_CRIMINALRECORD;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_MARITALSTATUS = c.B_2_VICTIM_PERSONALDATA_MARITALSTATUS;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_STRUCTUREOFTHEFAMILYOFORI = c.B_2_VICTIM_PERSONALDATA_STRUCTUREOFTHEFAMILYOFORI;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_NO_OFCHILDRENOFTHEVICTIM = c.B_2_VICTIM_PERSONALDATA_NO_OFCHILDRENOFTHEVICTIM;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_EDUCATIONINCLUDESPRIMARYS = c.B_2_VICTIM_PERSONALDATA_EDUCATIONINCLUDESPRIMARYS;
          recordToWhichToReplicate.B_2_VICTIM_PERSONALDATA_STATUSOFTHEVICTIMTOWARDSI = c.B_2_VICTIM_PERSONALDATA_STATUSOFTHEVICTIMTOWARDSI;
          recordToWhichToReplicate.B_2_VICTIM_LIVINGSITUATIONBEFOREDEPA_PERSONTHEVICTIMWASLIVINGW = c.B_2_VICTIM_LIVINGSITUATIONBEFOREDEPA_PERSONTHEVICTIMWASLIVINGW;
          recordToWhichToReplicate.B_2_VICTIM_COUNTRYORRESIDENCEBEFORED_COUNTRYOFRESIDENCE = c.B_2_VICTIM_COUNTRYORRESIDENCEBEFORED_COUNTRYOFRESIDENCE;
          recordToWhichToReplicate.B_2_VICTIM_PLACEOFRESIDENCEBEFOREDEP_PLACEOFRESIDENCEOFTHEVICT = c.B_2_VICTIM_PLACEOFRESIDENCEBEFOREDEP_PLACEOFRESIDENCEOFTHEVICT;
          recordToWhichToReplicate.B_2_VICTIM_INCOME_OCCUPATIONOFTHEVICTIMBEFO = c.B_2_VICTIM_INCOME_OCCUPATIONOFTHEVICTIMBEFO;
          recordToWhichToReplicate.B_2_VICTIM_ECONOMICSTATUSBEFOREDEPAR_PERCEPTIONOFTHEVICTIMOFHI = c.B_2_VICTIM_ECONOMICSTATUSBEFOREDEPAR_PERCEPTIONOFTHEVICTIMOFHI;
          recordToWhichToReplicate.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_IMPROVINGECONOMICALSTATUS = c.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_IMPROVINGECONOMICALSTATUS;
          recordToWhichToReplicate.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_SEARCHINGABETTERFUTURE = c.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_SEARCHINGABETTERFUTURE;
          recordToWhichToReplicate.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_POLITICALINSTABILITYINTHE = c.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_POLITICALINSTABILITYINTHE;
          recordToWhichToReplicate.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_PERSONALRELATIONSHIPWITHT = c.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_PERSONALRELATIONSHIPWITHT;
          recordToWhichToReplicate.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_OTHER = c.B_2_VICTIM_MOTIVESOFTHEVICTIMTOMIGRA_OTHER;
          recordToWhichToReplicate.B_2_VICTIM_LIAISONBETWEENTHEVICTIMSA_LIAISON = c.B_2_VICTIM_LIAISONBETWEENTHEVICTIMSA_LIAISON;
          recordToWhichToReplicate.B_2_VICTIM_ROLEORPROFESSIONOFTHEVICT_SEXUALEXPLOITATION = c.B_2_VICTIM_ROLEORPROFESSIONOFTHEVICT_SEXUALEXPLOITATION;
          recordToWhichToReplicate.B_2_VICTIM_ROLEORPROFESSIONOFTHEVICT_LABOUREXPLOITATION = c.B_2_VICTIM_ROLEORPROFESSIONOFTHEVICT_LABOUREXPLOITATION;
          recordToWhichToReplicate.B_2_VICTIM_ROLEORPROFESSIONOFTHEVICT_OTHERFORMSOFEXPLOITATION = c.B_2_VICTIM_ROLEORPROFESSIONOFTHEVICT_OTHERFORMSOFEXPLOITATION;
          recordToWhichToReplicate.B_2_VICTIM_MONEYREQUESTED_PAID_VICTIMIS_SOLD_FROMONEGROU = c.B_2_VICTIM_MONEYREQUESTED_PAID_VICTIMIS_SOLD_FROMONEGROU;
          recordToWhichToReplicate.B_2_VICTIM_MONEYREQUESTED_PAID_PRICEPAIDFORTHEVICTIM = c.B_2_VICTIM_MONEYREQUESTED_PAID_PRICEPAIDFORTHEVICTIM;
          recordToWhichToReplicate.B_2_VICTIM_MONEYREQUESTED_PAID_VICTIMSDEBTTOWARDSAUTHORS = c.B_2_VICTIM_MONEYREQUESTED_PAID_VICTIMSDEBTTOWARDSAUTHORS;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_SEIZUREOFVICTIMSDOCUMENTS = c.B_2_VICTIM_PERSDOCSEIZURE_SEIZUREOFVICTIMSDOCUMENTS;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_WORKPERMIT = c.B_2_VICTIM_PERSDOCSEIZURE_WORKPERMIT;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_ASYLUMREQUEST = c.B_2_VICTIM_PERSDOCSEIZURE_ASYLUMREQUEST;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_IDENTITYCARD = c.B_2_VICTIM_PERSDOCSEIZURE_IDENTITYCARD;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_PASSPORT = c.B_2_VICTIM_PERSDOCSEIZURE_PASSPORT;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_DRIVINGLICENSE = c.B_2_VICTIM_PERSDOCSEIZURE_DRIVINGLICENSE;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_VISA = c.B_2_VICTIM_PERSDOCSEIZURE_VISA;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_BIRTHCERTIFICATE = c.B_2_VICTIM_PERSDOCSEIZURE_BIRTHCERTIFICATE;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_MARRIAGECERTIFICATE = c.B_2_VICTIM_PERSDOCSEIZURE_MARRIAGECERTIFICATE;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_ORDERTOLEAVETHECOUNTRY = c.B_2_VICTIM_PERSDOCSEIZURE_ORDERTOLEAVETHECOUNTRY;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_RESIDENCEPERMIT = c.B_2_VICTIM_PERSDOCSEIZURE_RESIDENCEPERMIT;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_OTHER = c.B_2_VICTIM_PERSDOCSEIZURE_OTHER;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCSEIZURE_NODOCUMENTSUSED = c.B_2_VICTIM_PERSDOCSEIZURE_NODOCUMENTSUSED;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_USEOFFORGEDDOCUMENTS = c.B_2_VICTIM_PERSDOCFORGED_USEOFFORGEDDOCUMENTS;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_WORKPERMIT = c.B_2_VICTIM_PERSDOCFORGED_WORKPERMIT;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_ASYLUMREQUEST = c.B_2_VICTIM_PERSDOCFORGED_ASYLUMREQUEST;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_IDENTITYCARD = c.B_2_VICTIM_PERSDOCFORGED_IDENTITYCARD;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_PASSPORT = c.B_2_VICTIM_PERSDOCFORGED_PASSPORT;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_DRIVINGLICENSE = c.B_2_VICTIM_PERSDOCFORGED_DRIVINGLICENSE;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_VISA = c.B_2_VICTIM_PERSDOCFORGED_VISA;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_BIRTHCERTIFICATE = c.B_2_VICTIM_PERSDOCFORGED_BIRTHCERTIFICATE;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_MARRIAGECERTIFICATE = c.B_2_VICTIM_PERSDOCFORGED_MARRIAGECERTIFICATE;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_ORDERTOLEAVETHECOUNTRY = c.B_2_VICTIM_PERSDOCFORGED_ORDERTOLEAVETHECOUNTRY;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_RESIDENCEPERMIT = c.B_2_VICTIM_PERSDOCFORGED_RESIDENCEPERMIT;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_OTHER = c.B_2_VICTIM_PERSDOCFORGED_OTHER;
          recordToWhichToReplicate.B_2_VICTIM_PERSDOCFORGED_NODOCUMENTSUSED = c.B_2_VICTIM_PERSDOCFORGED_NODOCUMENTSUSED;
          recordToWhichToReplicate.B_2_VICTIM_RE_VICTIMISATION_RE_VICTIMISATION = c.B_2_VICTIM_RE_VICTIMISATION_RE_VICTIMISATION;
          recordToWhichToReplicate.B_2_VICTIM_RE_VICTIMISATION_OFTHESAMECRIME = c.B_2_VICTIM_RE_VICTIMISATION_OFTHESAMECRIME;
          recordToWhichToReplicate.B_2_VICTIM_RE_VICTIMISATION_SAMEAREAOFEXPLOITATION = c.B_2_VICTIM_RE_VICTIMISATION_SAMEAREAOFEXPLOITATION;
          recordToWhichToReplicate.B_2_VICTIM_RE_VICTIMISATION_AREAOFEXPLOITATION = c.B_2_VICTIM_RE_VICTIMISATION_AREAOFEXPLOITATION;
          recordToWhichToReplicate.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_AVERAGEDAILYINCOMEFROMSEX = c.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_AVERAGEDAILYINCOMEFROMSEX;
          recordToWhichToReplicate.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_AVERAGEINCOMEFROMOTHERFOR = c.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_AVERAGEINCOMEFROMOTHERFOR;
          recordToWhichToReplicate.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_AVERAGEMONTHLYINCOMEFROML = c.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_AVERAGEMONTHLYINCOMEFROML;
          recordToWhichToReplicate.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_INCOMERECEIVEDFORREMOVALO = c.B_2_VICTIM_AVERAGEINCOMEFROMEXPLOITA_INCOMERECEIVEDFORREMOVALO;
          recordToWhichToReplicate.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_LOCALS = c.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_LOCALS;
          recordToWhichToReplicate.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_INTERNATIONALS = c.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_INTERNATIONALS;
          recordToWhichToReplicate.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_MILITARY = c.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_MILITARY;
          recordToWhichToReplicate.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_POLICE = c.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_POLICE;
          recordToWhichToReplicate.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_CIVILIANS = c.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_CIVILIANS;
          recordToWhichToReplicate.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_OTHER = c.B_2_VICTIM_BACKGROUNDOFVICTIMSCLIENT_OTHER;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_POLICE = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_POLICE;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_JUDICIALAUTHORITY = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_JUDICIALAUTHORITY;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_NGO = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_NGO;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_GO = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_GO;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_HOSPITALORMEDICALFACILITI = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_HOSPITALORMEDICALFACILITI;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_INDIVIDUAL = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_INDIVIDUAL;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_HOTLINE = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_HOTLINE;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_OUTREACHSERVICES = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_OUTREACHSERVICES;
          recordToWhichToReplicate.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_OTHERAPPLICABLEWHENNOOTHE = c.B_2_VICTIM_FIRSTASSISTANCEREFERRAL_OTHERAPPLICABLEWHENNOOTHE;
          recordToWhichToReplicate.B_2_VICTIM_INSTITUTIONPROVIDINGASSIS_INSTITUTION = c.B_2_VICTIM_INSTITUTIONPROVIDINGASSIS_INSTITUTION;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_SELFEMPLOYMENT = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_SELFEMPLOYMENT;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_VOCATIONALTRAINING = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_VOCATIONALTRAINING;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_GRANT_SCHEME = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_GRANT_SCHEME;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_MICRO_CREDIT = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_MICRO_CREDIT;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_JOBREFERRALSUBSIDISEDEMPL = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_JOBREFERRALSUBSIDISEDEMPL;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_EDUCATION = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_EDUCATION;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_LEGALCOUNSELLING = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_LEGALCOUNSELLING;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_MEDICALREFERRALORASSISTAN = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_MEDICALREFERRALORASSISTAN;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_TEMPORARYRESIDENCEPERMIT = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_TEMPORARYRESIDENCEPERMIT;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_COVERINGDOCUMENTS = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_COVERINGDOCUMENTS;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_FAMILYSUPPORT = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_FAMILYSUPPORT;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_HOUSING = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_HOUSING;
          recordToWhichToReplicate.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_SHELTER = c.B_2_VICTIM_KINDOFASSISTANCEPROVIDED_SHELTER;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_TEMPORARYSAFEACCOMMODATIO = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_TEMPORARYSAFEACCOMMODATIO;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_FACILITATIONOFVISA_TRAVEL = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_FACILITATIONOFVISA_TRAVEL;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_TRAVELARRANGEMENTS = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_TRAVELARRANGEMENTS;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_DISBURSEMENTOFATRAVEL_RE_ = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_DISBURSEMENTOFATRAVEL_RE_;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_RISKASSESSMENTONORIGINCOU = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_RISKASSESSMENTONORIGINCOU;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_SECURINGOFTEMPORARYDOCUME = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_SECURINGOFTEMPORARYDOCUME;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_PLACETHEVICTIMCANGOTO = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_PLACETHEVICTIMCANGOTO;
          recordToWhichToReplicate.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_MEANSOFSUPPORTING = c.B_2_VICTIM_ASSISTANCEPROVIDEDFORRETU_MEANSOFSUPPORTING;
          recordToWhichToReplicate.B_2_VICTIM_INTENTIONSOFTHEVICTIMUPON_INTENTIONOFTHEVICTIMUPONH = c.B_2_VICTIM_INTENTIONSOFTHEVICTIMUPON_INTENTIONOFTHEVICTIMUPONH;

          dataContext.SubmitChanges();
          myMessage += recordToWhichToReplicate.ID + " - ";
        } //foreach




      } //foreach

      if (myMessage.Length > 0)
      {
        myMessage = "Entries that have been updated - " + myMessage;
      }
      else
      {
        myMessage = "No entries have updated";
      }

      System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>");
      System.Web.HttpContext.Current.Response.Write("alert('" + myMessage + "')");
      System.Web.HttpContext.Current.Response.Write("</SCRIPT>");
    }
  }
}